
<%@ page import="com.kn.FeeRun" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'feeRun.label', default: 'FeeRun')}" />
        <title><g:message code="default.list.label" args="[entityName]" /></title>
    </head>
    <body>
      <g:javascript library="pickbillingsched" />
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></span>
            <span class="menuButton"><a class="help" href="${createLink(uri: '/help')}"><g:message code="default.help.label"/></a></span>
        </div>
        <div class="body">


          <g:render template="/layouts/leftnav" />






          <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>

          <a href="javascript:promptForNetExFile();" id='pick_netexfile' class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only ui-state-hover"><span class="ui-button-text">Upload a new NetEx spreadsheet</span></a>

            <h1>Previously Uploaded</h1>
            
            <div class="list">
                <table>
                    <thead>
                        <tr>
                        
                            <g:sortableColumn property="dateCreated" title="Uploaded Date" />
                            <g:sortableColumn property="lastUpdated" title="Value Date" />
                            <th />

                        </tr>
                    </thead>
                    <tbody>
                    <g:each in="${feeRunInstanceList}" status="i" var="feeRunInstance">
                        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
                        
                    <td><g:link action="show" id="${feeRunInstance.id}"><g:formatDate date='${feeRunInstance.dateCreated}' type='datetime' style='LONG' timeStyle='SHORT'/></g:link></td>
                    <td><g:formatDate date='${feeRunInstance.valueDate}' type='date' style='LONG' timeStyle='SHORT'/></td>
                    <td>
                      <g:link action="show" id="${feeRunInstance.id}" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only ui-state-hover"><span class="ui-button-text">View</span></g:link>
                      <g:link class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only ui-state-hover" action="download" id="${feeRunInstance.id}"><span class="ui-button-text">Download</span></g:link>
                      <g:link action="invoice" id="${feeRunInstance.id}" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only ui-state-hover"><span class="ui-button-text">Invoices</span></g:link>
                    </td>
                        </tr>
                    </g:each>
                    </tbody>
                </table>
            </div>
            <div class="paginateButtons">
                <g:paginate total="${feeRunInstanceTotal}" />
            </div>
        </div>

        <div id="pickscheduleform" title="Select Billing Cycle">
          <g:form name="pickinvoicestartmonth" action="invoice" >
            <g:hiddenField id="pickFeeRunID" name="feeRunInstanceId" value="" />
            <div class="dialog">
              <div>
                Select the beginning month of the billing schedule: <kn:monthsListComboBox id="monthsListComboID"/>
              </div>

            </div>
          </g:form>
        </div>

       <div id="uploadnetexform" title="Upload NetEx File">
          <g:form name="uploadnetexfile" action="upload" action="upload" method="post" enctype="multipart/form-data">
            <div class="dialog">
                <input name="imgfile" id="imgfile" type="file" size="56" title="Browse..."/>
                <br />
                <br />
                <div>
                Value date as the last day of:
                <g:datePicker name="pickValueDate" precision="day" value="" years="${2005..2030}" />
              </div>
                </div>
          </g:form>

        </div>
    </body>
</html>
